﻿using System;
using System.Windows;
using System.Windows.Data;

namespace WIAssistant
{
    [ValueConversion(typeof(double), typeof(String))]
    public class BooleanToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,System.Globalization.CultureInfo culture)
        {
            bool invertLogic = false;
            if (parameter != null)
                invertLogic = System.Convert.ToBoolean(parameter);

            bool input = (bool)value;
            if (invertLogic)
                input = !input;

            if (input)
                return Visibility.Visible;
            else
                return Visibility.Collapsed;
        }
        public object ConvertBack(object value, Type targetType,object parameter,System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

    }
}